<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/16 0016
 * Time: 15:54
 */
namespace app\admin\model;
use think\Db;

class GetOccupation
{
    static public function get($id,$array=[]){
        $data = Db::name('occupation')->where('id',$id)->find();
        $array[] = $data['id'];
        $datas = Db::name('occupation')->where('pid',$id)->select();
        foreach ($datas as $value){
            $array = GetOccupation::get($value['id'],$array);
        }
        return $array;
    }
    static public function gets($id){
        if(is_array($id)){
            $array =[];
            foreach ($id as $value){
                $array = array_merge($array,GetOccupation::get($value));
            }
            return $array;
        }else{
            return GetOccupation::get($id);
        }
    }
}